
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



CREATE VIEW [dbo].[TMCLIE] AS
SELECT    
T1.[CO_CLIE], T1.[CO_EMPR], T1.[TI_NATU_JURI], 
T1.[AP_PATE_CLIE], T1.[AP_MATE_CLIE], T1.[NO_NATU_0001], T1.[NO_NATU_0002],  T1.[NO_RAZO_SOCI], 
T1.[NO_REPR], T1.[NO_CLIE], T3.DE_DIRE NO_DIRE, T1.[FE_INGR], 
T1.[TI_DOCU_IDEN], T1.[NU_DOCU_IDEN], T1.[NU_RUCS], T1.[CO_TIPO_CLIE], T1.[CO_GRUP_ECON], T1.[CO_VEND], T1.[CO_COBR], T1.[CO_COND_PAGO],
T1.[CO_CATE_CLIE], T1.[ST_COND_OBLI], T1.[CO_ZONA], T1.[PC_DCTO], T1.[CO_LIST_PREC], T1.[DE_OBSE], 
T1.[CO_MONE_CRED], T1.[IM_LIMI_CRED], T1.[IM_CRED_EXCE], T1.[CO_DOCU_SUNA], T1.[NU_DOCU_SUNA], T1.[TI_PERS_SUNA], 
T1.[NU_RETE_SUNA], T1.[CO_AGTR_DEFA], T1.[TI_SITU], T1.[ST_BLOQ_COTV], T1.[ST_BLOQ_PEDV], T1.[ST_BLOQ_GUIA], T1.[ST_BLOQ_FABO], 
T1.[ST_BLOQ_NCRE], T1.[ST_BLOQ_NDEB], T1.[ST_BLOQ_FAEX], T1.[ST_BLOQ_NCEX], T1.[ST_BLOQ_NDEX], T1.[TI_DOCU_DEFA],
T1.[ST_BLOQ_MORO], T1.[CO_MONE_DEFA], T1.[TI_CLIE_DCTO], 
T1.[CO_USUA_CREA], T1.[FE_USUA_CREA], T1.[CO_USUA_MODI], T1.[FE_USUA_MODI], 'N' AS 'ST_PERC', 'N' AS 'ST_RETE'
FROM [OFIVENT].[dbo].[TMCLIE] T1 LEFT OUTER JOIN [OFIVENT].[DBO].[TDDIRE_CLIE] T3 
ON (T1.CO_EMPR = T3.CO_EMPR              
AND T1.CO_CLIE = T3.CO_CLIE              
AND T3.TI_DIRE = 'COM' )

GO
